package com.itheima.config;

import com.itheima.interceptor.LoginCheckInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * WebConfig
 *
 * @author liliudong
 * @version 1.0
 * @description
 * @date 2023/7/18 15:20
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
       registry.addInterceptor(new LoginCheckInterceptor())
               // 拦截所有路径
               .addPathPatterns("/**")
               // 排除登录请求
               .excludePathPatterns("/login");
    }
}
